package com.one.blocks.rbac.controller.vo.tree;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.one.blocks.mvc.domain.Id;
import com.one.blocks.mvc.domain.TreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author <a href="mailto:idler41@163.con">idler41</a> created on 2022-05-01 10:06:14
 */
@ApiModel(value = "系统菜单权限")
@Data
public class SysMenuTreeNodeVo implements TreeNode<SysMenuTreeNodeVo, Integer>, Id<Integer>, Serializable {

    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID")
    private Integer id;

    /**
     * 目录名称(router名称)
     */
    @ApiModelProperty(value = "目录名称(router名称)")
    private String name;

    /**
     * 目录标题
     */
    @ApiModelProperty(value = "目录标题")
    private String title;
    /**
     * 上级目录id
     */
    @ApiModelProperty(value = "上级目录id")
    private Integer parentId;

    /**
     * 目录类型: 0-目录 1-菜单 2-按钮
     */
    @ApiModelProperty(value = "目录类型: 0-目录 1-菜单 2-按钮")
    private Integer type;

    /**
     * 权限标识
     */
    @ApiModelProperty(value = "权限标识")
    private String perms;

    /**
     * 目录状态: 0-禁用 1-正常
     */
    @ApiModelProperty(value = "目录状态: 0-禁用 1-正常")
    private Integer state;

    /**
     * 是否外链: 0-否 1-是
     */
    @ApiModelProperty(value = "是否外链: 0-否 1-是")
    private Integer linkFlag;

    /**
     * 是否缓存: 0-否 1-是
     */
    @ApiModelProperty(value = "是否缓存: 0-否 1-是")
    private Integer cacheFlag;

    /**
     * 是否可见: 0-否 1-是
     */
    @ApiModelProperty(value = "是否可见: 0-否 1-是")
    private Integer visible;

    /**
     * 显示层级
     */
    @ApiModelProperty(value = "显示层级")
    private Integer levelNum;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    private Integer orderNum;

    /**
     * 路由地址
     */
    @ApiModelProperty(value = "路由地址")
    private String path;

    /**
     * 组件地址
     */
    @ApiModelProperty(value = "组件地址")
    private String component;

    /**
     * 菜单图标
     */
    @ApiModelProperty(value = "菜单图标")
    private String icon;


    @ApiModelProperty(value = "子目录")
    private List<SysMenuTreeNodeVo> children;

    @JsonIgnore
    @Override
    public Integer getLevel() {
        return this.levelNum;
    }
}